﻿using System;
using System.Collections.Generic;
#if DEBUG
using System.Diagnostics;
#endif // #if DEBUG
using System.Linq;
using System.Web;

namespace FRL.DebtChased.Types
{

	/// <summary>
	/// Extension class for Money class
	/// </summary>
	public partial class Money
	{

		/////////////////////////////////////////////////////////////////
		#region Implementation of IFormattable

		public string ToString( string format, IFormatProvider formatProvider )
		{
#if DEBUG
			Debug.Assert(this.Currency != eCurrency.NotSet);
#endif // #if DEBUG

			// Call sibling function
			return Format( ( (format != null) && (format.Contains("B")) ) );

		}

		#endregion Implementation of IFormattable

		/////////////////////////////////////////////////////////////
		// Static Operations

		public static Dictionary<string, string> GetDictionary()
		{

			// Declare return variable
			Dictionary<string, string> Ftmp = new Dictionary<string, string>();

			// loop through currencies
			Array values = Enum.GetValues(typeof(eCurrency));
			foreach (eCurrency c in values)
			{

				// Ignore "NotSet" and "mixed" value
				if (c == eCurrency.NotSet)
					continue;
				if (c == eCurrency.Mixed)
					continue;

				// Get currency sign and code
				string strSign = CurrencyToSymbol(c);
				string strCode = CurrencyToCode(c);

				// Add to map
				Ftmp.Add(strCode, strSign);

			}

			// Return variable
			return Ftmp;

		}

	}

}